home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / lzw4c11.zip / EXPAND.C < prev    next >
Text File  |  1992-11-08  |  925b  |  45 lines

  1. /*
  2. **  EXPAND.C      Copyright (C) 1992 by MarshallSoft Computing, Inc.
  3. **
  4. **  Expands file previously compressed with COMPRESS.
  5. **  Usage is:  EXPAND <input_file> <output_file>
  6. */
  7.  
  8. #include <stdio.h>
  9. #include "LZW4C.H"
  10. #include "RW_IO.H"
  11.  
  12. #define FALSE 0
  13. #define TRUE !FALSE
  14.  
  15. extern char *malloc();
  16. extern int free();
  17.  
  18. void main(argc,argv)
  19. int argc;
  20. char *argv[];
  21. {int RetCode;
  22.  /* begin */
  23.  if(argc<3)
  24.    {printf("Useage: EXPAND <infile> <outfile>\n");
  25.     exit(1);
  26.    }
  27.  if((RetCode=InitLZW(malloc))<0)
  28.    {SayError(RetCode);
  29.     exit(2);
  30.    }
  31.  /* open input file */
  32.  if(!ReaderOpen(argv[1])) exit(3);
  33.  /* open output file */
  34.  if(!WriterOpen(argv[2])) exit(4);
  35.  /* expand the compressed file */
  36.  printf("Expanding %s",argv[1]);
  37.  if((RetCode=Expand(Reader,Writer))<0)
  38.    {SayError(RetCode);
  39.     exit(3);
  40.    }
  41.  /* close files */
  42.  ReaderClose();
  43.  WriterClose();
  44.  TermLZW(free);
  45. }